#include "VerticalModel.h"

VerticalModel* VerticalModel::verticalModel = NULL;

VerticalModel* VerticalModel::initInstance(vector3 emergePoint, float pipeLength, float width){
	if (verticalModel == NULL){
		verticalModel = new VerticalModel(emergePoint, pipeLength, width);
	}
	return verticalModel;
}

VerticalModel* VerticalModel::getInstance(){
	if (verticalModel == NULL){
		verticalModel = new VerticalModel();
	}
	return verticalModel;
}

vector3 VerticalModel::getPosition(){
	vector3 pos;
	int modX = width * 100;
	pos.x = (float)(rand() % modX) / 100 + emergePoint.x - width / 2;

	int modY = pipeLength * 100;
	pos.y = (float)(rand() % modY) / 100 + emergePoint.y;

	int modZ = width * 100;
	pos.z = (float)(rand() % modZ) / 100 + emergePoint.z - width / 2;

	return pos;
}

vector3 VerticalModel::getVelocity(){
	vector3 vel = vector3(0, -1, 0);
	vel *= this->velocity;
	return vel;
}